package com.kyh.util;

import java.math.BigDecimal;

/**
 * MODEL工具类
 */
public abstract class AmountUtil {

	public static BigDecimal getQrcodeAmount(
			BigDecimal amountin
			) {
		BigDecimal qrcodensamount = amountin;
		
		// 设置指定范围
		amountin = amountin.setScale(2, BigDecimal.ROUND_HALF_UP);
		if (amountin.compareTo(new BigDecimal(0.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(99.92);
		} if (amountin.compareTo(new BigDecimal(99.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(199.92);
		} else if (amountin.compareTo(new BigDecimal(199.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(299.92);
		} else if (amountin.compareTo(new BigDecimal(299.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(399.92);
		} else if (amountin.compareTo(new BigDecimal(399.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(499.92);
		} else if (amountin.compareTo(new BigDecimal(499.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(599.92);
		} else if (amountin.compareTo(new BigDecimal(599.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(699.92);
		} else if (amountin.compareTo(new BigDecimal(699.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(799.92);
		} else if (amountin.compareTo(new BigDecimal(799.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(899.92);
		} else if (amountin.compareTo(new BigDecimal(899.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(999.92);
		} else if (amountin.compareTo(new BigDecimal(999.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(1099.92);
		} else if (amountin.compareTo(new BigDecimal(1099.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(1199.92);
		} else if (amountin.compareTo(new BigDecimal(1199.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(1299.92);
		} else if (amountin.compareTo(new BigDecimal(1299.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(1399.92);
		} else if (amountin.compareTo(new BigDecimal(1399.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(1499.92);
		} else if (amountin.compareTo(new BigDecimal(1499.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(1599.92);
		} else if (amountin.compareTo(new BigDecimal(1599.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(1699.92);
		} else if (amountin.compareTo(new BigDecimal(1699.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(1799.92);
		} else if (amountin.compareTo(new BigDecimal(1799.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(1899.92);
		} else if (amountin.compareTo(new BigDecimal(1899.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(1999.92);
		} else if (amountin.compareTo(new BigDecimal(1999.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(2099.92);
		} else if (amountin.compareTo(new BigDecimal(2099.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(2199.92);
		} else if (amountin.compareTo(new BigDecimal(2199.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(2299.92);
		} else if (amountin.compareTo(new BigDecimal(2299.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(2399.92);
		} else if (amountin.compareTo(new BigDecimal(2399.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(2499.92);
		} else if (amountin.compareTo(new BigDecimal(2499.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(2599.92);
		} else if (amountin.compareTo(new BigDecimal(2599.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(2699.92);
		} else if (amountin.compareTo(new BigDecimal(2699.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(2799.92);
		} else if (amountin.compareTo(new BigDecimal(2799.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(2899.92);
		} else if (amountin.compareTo(new BigDecimal(2899.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(2999.92);
		} else if (amountin.compareTo(new BigDecimal(2999.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(3099.92);
		} else if (amountin.compareTo(new BigDecimal(3099.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(3199.92);
		} else if (amountin.compareTo(new BigDecimal(3199.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(3299.92);
		} else if (amountin.compareTo(new BigDecimal(3299.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(3399.92);
		} else if (amountin.compareTo(new BigDecimal(3399.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(3499.92);
		} else if (amountin.compareTo(new BigDecimal(3499.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(3599.92);
		} else if (amountin.compareTo(new BigDecimal(3599.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(3699.92);
		} else if (amountin.compareTo(new BigDecimal(3699.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(3799.92);
		} else if (amountin.compareTo(new BigDecimal(3799.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(3899.92);
		} else if (amountin.compareTo(new BigDecimal(3899.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(3999.92);
		} else if (amountin.compareTo(new BigDecimal(3999.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(4099.92);
		} else if (amountin.compareTo(new BigDecimal(4099.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(4199.92);
		} else if (amountin.compareTo(new BigDecimal(4199.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(4299.92);
		} else if (amountin.compareTo(new BigDecimal(4299.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(4399.92);
		} else if (amountin.compareTo(new BigDecimal(4399.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(4499.92);
		} else if (amountin.compareTo(new BigDecimal(4499.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(4599.92);
		} else if (amountin.compareTo(new BigDecimal(4599.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(4699.92);
		} else if (amountin.compareTo(new BigDecimal(4699.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(4799.92);
		} else if (amountin.compareTo(new BigDecimal(4799.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(4899.92);
		} else if (amountin.compareTo(new BigDecimal(4899.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(4999.92);
		} else if (amountin.compareTo(new BigDecimal(4999.99).setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
			qrcodensamount = new BigDecimal(5099.92);
		}
		
		
		return qrcodensamount;
	}
	
	public static void main(String[] args) {
		BigDecimal amountin = new BigDecimal(10.00).add(new BigDecimal(0.01));
		BigDecimal amountcompare = new BigDecimal(10.01);
		amountin = amountin.setScale(2, BigDecimal.ROUND_HALF_UP);
		System.out.println("amountin=====" + amountin);
		System.out.println("amountcompare=====" + amountcompare);
		System.out.println("对比结果=====" + amountin.compareTo(amountcompare.setScale(2, BigDecimal.ROUND_HALF_UP)));
	}
}
